package FSMDemo.entity.mine
{
	import com.cheezeworld.entity.Entity;
	import com.cheezeworld.entity.GameCamera;
	import com.cheezeworld.rendering.BitmapRenderer;
	import com.urbansquall.ui.CustomTextField;
	
	import flash.display.DisplayObjectContainer;
	import flash.display.Graphics;

	public class MineRenderer extends BitmapRenderer
	{
		public function MineRenderer(a_entity:Entity, a_camera:GameCamera, a_canvas:DisplayObjectContainer, a_data:Object)
		{
			super(a_entity, a_camera, a_canvas, a_data);
			
			m_statusText = new CustomTextField( "Test", 0xFF0000, 14);
			_container.addChild( m_statusText );
		}
		
		protected override function draw():void
		{	
			var g:Graphics = _container.graphics;	
			g.clear();
			
			g.lineStyle( 1 , 0xFFFF00 );
			g.drawCircle( 0, 0, _entity.radius );
			
			m_statusText.text = Mine(_entity).remainingMinerals.toPrecision( 2 ) + " gold remaining.";
			m_statusText.x = - m_statusText.width / 2;
			m_statusText.y = -_container.height / 2 - m_statusText.height;
		}
		
		private var m_statusText:CustomTextField;
		
	}
}